package com.lc.service.impl;

import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import com.lc.bean.GoodsType;
import com.lc.mapper.GoodsTypeMapper;
import com.lc.service.GoodsTypeService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class GoodsTypeServiceImpl implements GoodsTypeService {


    @Autowired
    GoodsTypeMapper goodsTypeMapper;

    @Override
    public PageInfo<GoodsType> list(GoodsType goodsType, Integer pageNum, Integer pageSize) {
        PageHelper.startPage(pageNum,pageSize);

        List<GoodsType> goodsTypes = goodsTypeMapper.selectAll(goodsType);

        return new PageInfo<>(goodsTypes);
    }

    @Override
    public void del(Long id) {
        goodsTypeMapper.deleteByPrimaryKey(id);
    }

    @Override
    public void save(GoodsType goodsType) {
        goodsTypeMapper.save(goodsType);
    }

    @Override
    public GoodsType findById(Long uuid) {
        return goodsTypeMapper.selectByPrimaryKey(uuid);
    }

    @Override
    public void update(GoodsType goodsType) {
        goodsTypeMapper.updateByPrimaryKey(goodsType);
    }

    @Override
    public List<GoodsType> selectItem() {
        return goodsTypeMapper.selectItem();
    }
}
